package com.javafactroy.kunlong.base.utils;

import lombok.Data;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Data
public class GeneralThreadPool {
    private static ThreadPoolExecutor threadPool;

    public static ThreadPoolExecutor inst() {
        if (threadPool == null) {
            init();
        }
        return threadPool;
    }

    public static void init() {
        threadPool = new ThreadPoolExecutor(10, 15, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>());

    }
}
